# $Id: PKGBUILD 90057 2013-05-06 19:38:13Z foutrelis $
# Maintainer: Lukas Jirkovsky <l.jirkovsky@gmail.com>
# Contributor: flixie <69one@gmx.net>
# Contributor: Imanol Celaya <ornitorrincos@archlinux-es.org>
pkgname=luxrender
pkgver=1.2.1
_pkgver=3066b2161439
pkgrel=3
pkgdesc="Rendering system for physically correct, unbiased image synthesis"
arch=('i686' 'x86_64')
url="http://www.luxrender.net/"
license=('GPL')
depends=('boost-libs' 'freeimage' 'openexr' 'libcl' 'libgl')
optdepends=('luxblend25: Blender exporter' 'qt4: Qt GUI' \
            'python: Python interface (pylux)'
            'nvidia-utils: OpenCL support for nVidia GPUs' \
            'amdstream: OpenCL support for AMD GPUs' \
            'intel-opencl-sdk: OpenCL support for Intel CPUs')
makedepends=('cmake' 'boost' 'mesa' 'qt4' "luxrays=1.2" 'python' 'opencl-headers')
source=(https://bitbucket.org/luxrender/lux/get/$_pkgver.tar.bz2 \
        boost-1.53-shared_array_constructor.diff)
md5sums=('87958798c164ad14f92fb4af2595d332'
         'dd19c7ac2ba8c9b703018a176ef77f98')

build() {
  cd "$srcdir"/luxrender-lux-$_pkgver

  # fix the installation
  sed -i '/.*wxgui.*/ d' CMakeLists.txt
  # fix for boost 1.53
  patch -Np1 < "$srcdir/boost-1.53-shared_array_constructor.diff" || true

  export CXXFLAGS="$CXXFLAGS -lpthread"
  cmake -DCMAKE_INSTALL_PREFIX=/usr \
    -DLUXRAYS_DISABLE_OPENCL=OFF \
    -DPYTHON_CUSTOM=ON \
    -DPYTHON_LIBRARIES=/usr/lib/libpython3.3m.so \
    -DPYTHON_INCLUDE_PATH=/usr/include/python3.3m/ \
    .
  make
}

package() {
  cd "$srcdir"/luxrender-lux-$_pkgver
  make DESTDIR="$pkgdir" install

  # fix library path on x86_64
  [ "$CARCH" = "x86_64" ] && mv "$pkgdir"/usr/lib64 "$pkgdir"/usr/lib

  #install pylux
  install -D -m644 pylux.so "$pkgdir"/usr/lib/python3.3/pylux.so
}

# vim:set ts=2 sw=2 et:
